package std.bank;

import java.util.HashMap;

public class BankImpl implements Bank
{
	HashMap<String, Account> accounts;

	public BankImpl()
	{
		accounts = new HashMap<String, Account>();
	}

	@Override
	public boolean equals(Object o)
	{
		if (o == this)
		{
			return true;
		}
		if (o == null || o.getClass() != getClass())
		{
			return false;
		}

		return true;
	}

	@Override
	public Account getAccount(String name)
	{
		Account account = accounts.get(name);
		if (account != null)
			return account;
		else
		{
			account = new AccountImpl(name, 0);
			accounts.put(name, account);
			return account;
		}
	}
}
